#include "cmd.h"
#include "stdio.h"
#include "flag.h"
int roorHandler(int argc, char **argv){
    printf("this is root handler\n");
    printf("%d\n", argc);
}

int sub1Handler(int argc, char **argv){
    printf("this is sub1 handler\n");
    printf("%d\n", argc);
}


int main(int argc, char **argv){

    CcliCmd *rootCmd = CCLIRootCmdInit("this is root cmd usage", roorHandler);
    CcliCmd *sub1Cmd = CCLISubCmdInit("sub1", "this is sub1 cmd usge", sub1Handler);
    CCLICmdAddSubCmd(rootCmd, sub1Cmd);
    CCLICmdExec(rootCmd, argc, argv);
    int test;
    CCLIFlagHandler *flagHandler = CCLIFlagHandlerInit();
    CCLIFlagSetInt(flagHandler, &test, "t", "test", 1, "this is test description");
    argc--;
    argv++;
    CCLIFlagParse(flagHandler, &argc, &argv);
    printf("test %d\n", test);
}